<%@page import="vlms.bean.SimpleCustomer" %>
<%@page import="vlms.bean.PremiumCustomer" %>
<%@page import="vlms.bean.Person" %>
<%@page import="vlms.bean.Account" %>
<%@page import="wrapper.CartMovie"  %>
<%@page import="java.lang.*"  %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@ include file="/title.html" %>
</head>
<body>
<table width="100%">
<%@ include file="/header.jsp" %>

<tr valign="top"><td align="center" height="300px">
<table width="100%">

<tr valign="top" height="50px">
<td align="center">
<%@ include file="/headerLinks.jsp" %>
</td>
</tr>
<tr><td align="center" height="40px" colspan="2" valign="top"><h3>Your Order Summary is as follows:</h3></td></tr>
<% if(request.getAttribute("message") != null) { %>
<tr><td align="center" style="color:red"><%= request.getAttribute("message") %></td></tr>
<% } %>

<%if(null != request.getAttribute("CartMovie")) { 
%>  
<tr>
    <td align="center">
    <table  width="90%" style="text-align:left">
        <tr>
            <td width="5%">No.</td>
            <td width="10%">Movie Name</td>
            <td width="15%">Banner</td>
            <td width="8%">Category</td>
            <td width="12%">Rent Amount</td>
            <td width="15%">Availability</td>
            <td width="25%"></td>
            <td width="15%">Price for You</td>           
        </tr>
        
        <% SimpleCustomer oSC = (SimpleCustomer)session.getAttribute("SimpleCustomer");
PremiumCustomer oPC = (PremiumCustomer)session.getAttribute("PremiumCustomer");
Person oPerson = (Person)session.getAttribute("Person");
Account oAccount = (Account)session.getAttribute("Account");
%>
        
<%  
    CartMovie aCartMovie[] = (CartMovie[]) request.getAttribute("CartMovie");
    String memType = (String) session.getAttribute("MemberType");
    int cartItemId = 0, itemId=0, quantityInCart = 0;
    int i,j;
    float total = 0;
    for(i=0;i<aCartMovie.length;i++) {
    	String availability = "Out Of Stock";
    	boolean available = false;
    	float yourPrice;
    	if(aCartMovie[i].getCopiesavailable() > 0) {
    		  total += (aCartMovie[i].getRentamount());
    		  availability = "In Stock";
    		  available = true;
    	}
    	if(memType.equals("SC"))
    	yourPrice =  aCartMovie[i].getRentamount();
    	else
    		yourPrice = 0.0f;
%>
    <form name="updateCart_<%=aCartMovie[i].getIssueid() %>" action="UpdateCart" method="post">
        <tr style="text-align:left">
            <td><%=i+1%></td>
            <td><%=aCartMovie[i].getMoviename() %></td>
            <td><%=aCartMovie[i].getMoviebanner() %></td>
            <td><%=aCartMovie[i].getCategory() %></td>
            <td><%=aCartMovie[i].getRentamount()%></td>
            <td><%=availability %></td>
            <td>                
                <input type="submit" name="submit" value="Delete">
            </td>
            <td>
            	<%=yourPrice%>      
            
            </td>
            
            <input type="hidden" name="cartId" value="<%=aCartMovie[i].getIssueid() %>">
            
            
        </tr>
    </form>     
<%  } %>
    <tr>
        <td colspan="8"></td>       
    </tr>
    <tr>
        <td colspan="8"><hr></td>       
    </tr>
    <tr>
        <td colspan="6"></td>
        <td align="left">Total</td>
        <td align="left"><%=total%></td>
    </tr>
    <tr>
        <td colspan="8" height="30px">
        </td>
    </tr>
    
    <tr>
        <td colspan="7"></td>
        <td align="left">
            <form name="checkout" action="Checkout" method="post">
                <input type="submit" name="submit" value="Checkout">
            </form>
        </td>
    </tr>
    </table>
    </td>
</tr>
<%} %>

</table>
</td>
</tr>

<%@ include file="/bottom.html" %>
</table>
</body>
</html>